package com.hqj.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hqj.entity.TMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hqj
 * @since 2020-06-10
 */
public interface TMenuDao extends BaseMapper<TMenu> {

    @Select("select DISTINCT(m.id),m.* from t_menu m,t_role_menu rm  " +
            "where m.id = rm.mid and rm.rid  " +
            "in (select ur.rid from t_user_role ur where ur.uid = ${uid})")
    public List<TMenu> getMenuJsonByUserId(@Param(value = "uid") int uid);

}
